Refactoring

closes #32, closes #12, closes #10, closes #9