little clean up, some debugging, optional support