revise lib and tests