Major rewrite of the mapper file

Moved everything to a single class, among other things