Refactoring after code review from Puneeth