lib: implement function, code