added processCommand function