Splitting logic into modules