change logic to match new circular buffer
reorganize codeblocks, remove dead funcs
update init function name n comment
update function name for data init
use circular buffer for all data and records