Do the monadic stuff more properly