add tests, make api sensible