refactored code for smooth deploy