resource work
use new resource monad
remove terrible template haskell hacks