Code refactoring into multiple files in 'utils' directory