moved code into clibar.c and prototypes into clibar.h