Refactoring

Some portion of code still needs to be DRYied and follow proper conventions. This PR will target them.