Refactor code

Initial refactoring.

- Closes #5 :smiley: