Cleanup some API, add some tests/validation