minus some debugging code