clib code cleanup