Refactoring

Refactoring into methods, adding current location logic, header updates