Moved mapping stuff to its own file