code for face detection cleaned up