moved some awkward functionality into a new custom module