added error handling to Lookup