..F....... [DEV-543] Refactor controller spaghetti into separate functions for output and processing.