changed the Pair to be immutable, and updated effected code