Fix header footer issue
Improve position array useage