Code refactoring - splitting logic into different files.