Refactoring manager code