Code cleanup
Added support for PDF output