Changed loading mechanism to be more robust.