Implemented most of the lookup functions