Moved --wait commandline argument code to utils