Closes #44, tests passing