Refactoring to be more scheme-like