refactoring; added error callback to media search