Added some documentation, as well some refactoring and cleanup
Documentation spree!