remove debugging, add thunkify, cleaning up