some buffers added for speed improvement
new version