added 'formatted' param to addHeader. jshinted code, added some missing semicolons and replaced invalid spaces