Optimize  getCaretPosition function a bit
Remove textcomplete-wrapper
Accept function as header and footer options