Moving composition logic into its own module