modularized code a little for palm detection of face down