Refactored commander server and commander to extract protocol from application logic