added missing clone keyword and lengthy comment to explain prototype logic