Implemented pdf upload, refactoring