Is there a better way to do this other than sleeping for 10 seconds?