Adjusted code format and added sleep()