split out some logic into another module