Added full support for landscape and portrait orientations. Added selection between horizontal and vertical scanning directions