Implemented part of the resize algorithm
First working version of the resize with multiple header rows