Refactoring and version update. Fixes #159