Beginning changes to lookup algorithm