Added function to check if command exists.