Last fixes / refactoring

Closes #14