Added auto selection of portrait/landscape