Trying to get things to work a bit better with a sleep function.