code refactoring - rachit