Some more debugging and a cleanup