added logic to screen rotation, improved take screenshot logic