Fixed documentation, changed some design of the program, added some new functions and test code