minor changes
Refactored everything to monads