manually merged gonzo's changes