chethan refactored code