refactor main, parser; fix monad