This PR applies on top of #52. Resolves #51