Moved searching for image to background thread

More refactoring needed.