Switch to using a Free monad