Added tests for encoding, sending, parsing and actioning an action string. Further cleanup to code.