refactored uploads. use separate database and docs.