Added add post function and test code.