Added some comments and re-arranged functions

TO DO:
[ ] Add reports view