added library and test code