final version with massive buffer