better way to manage loading overlay