Update to v3.1.2 and add test suite