improved command parsing