Further code modifications are on Github