removed an wait function, and a for loop