Complete face detection and code optimization