clean up device orientation code