copy of the prototype code