Wrote lookup function for part 1