Rewrote to improve the reading (one step before writer monad)