make it a library and add test executable