Move model saving function to bottom of file.