Refactoring and cleanup before moving onto the new tasks