Changes to mapping algorithm