Fix wrong type, use generic monad classes for some ops