Removed old code and split refresh function.