implemented triple buffer (#27)