added doc_id to app routes
refactored to make doc_id less redundant