Tidy up code

Used abstract mapping class for models