working on improving functions for getting PDF