Improved command handling to use annotations