Move usleep() and refresh()/clear() to more logical location