refactored code out of src/Dodgy.hs