Re-implement doc loading