refactored again to get rid of reloading flicker