refactor compose function
removed require
added Writer monad