add sleep to read() function to reduce usage of CPU