Implemented head match rule of commands.