beginning of resize and orientation