doc manipulation functions all implemented along with test cases