Add newline add end of file
Refactor parseCommandTable

To accept variable header and footer lengths
Refactor users to use parseCommandTable