Refactor monadic code in run
Code cleanup, some haddock