Added commenting, refactored controllers and added more comments