Refactoring & cleaning up