Replaced fixed wait time with spin lock