Refactor: Change resize algorithm.