refactored several lookup functions