set orientation to portrait; code refactoring