moved refresh rate to gap between main loops