Added error checking to goal. Also added invalid command