cleaning up code for pdf