Split up the refresh() function to provide other useful functions.