Moved lookup function further down in file