circular buffer and data structs. initial working buffering for STDIN