Added some functions and a test document