Modified class mapper to deal with references