removed unused function
switch to monad implementation