Adding method to handle commands to server