slight refactoring
Resolves #5. Updates #6 and #9. Still very buggy