Refactoring memo handler into something more sane.