Code refactored'