clean up device orientation code
Merge branch 'master' into gh-pages