Closes #95 based on refactoring