refactoring: use proper event handlers
started with parsing the commands