Refactored face detection without pop ups