This is oddly duplicated in the JS lib...