Add some documentation and cleanup of mapping code