Relates to #7. Refactored out the transformations into the listener