Begin to refactor controller to be generic enough to manage different protocol.