Refactored code according to list