Added Implementation for Document, along with unit tests to ensure correctness