Moved all commands to the new if statement