cleaning up and fixing time buffer