edited addCommand

changed logic flow