implemented #366 and removed extraneous thread sleep