Add tests, fix interface-related bugs