Adding document upload functionality. Needs a lot of cleaning, but it works.