Added some inline documentation, simplified some of the header/footer generation
Created up to date minified version