Break out the function loading into a seperate if block