add more events test case. add error handling for invalid commands
rewrite according the code guideline