Refactor code

Streamline controller workflow. Adjust protocol accordingly.
Fix debug listener in protocol.