More refactoring
fixes #7