Test and debugging improvements