Refactored some code + added comments and added some of the method defenitions for the rest of the front end