preview rotates according to device rotation
code cleanup