Add parts of the original minimap code