Refactor package

Closes #19, #18, #11.