Renamed function and minor cleanup.