Refactor. Closes #55