separated stdio functions. Added the RB tree insert, not tested yet