this would be easier with a reader monad
modify test