lib implementation