Move model layer into own file.