removed extra copies and added some debugging helpers