Moved model related functions into seperate file, added name field to model.
Added saving and loading of projects
Added casts to eliminate compiler warnings