move monadstate fns into core