(REBASE PLEASE) Further progress in debugging and testing