Added the onCommand function