copied chanks implementation