add library and test code