simplified api, changed the data types a bit, and added some tests