Convert to package

***Not ready for merge***
This builds on the work done in #27 so should wait until that has been merged.