tweaked the searching process, added more error reporting