some general polish. typos and switched attempted blocking loop for setTimeout.