refactored changeSizeOfView method