write logic into separate module