added functions to header and variable decs to .c