removed busy waiting, added test