implemented topics, refactored with documents