adding sleep to reduce cpu consumption