replaced arbitrary sleep with smarter file content test