Finished refactoring and adding comments
Merged dev into feature-terry