Add more comments and fix errors in tests-unit