still work in progress, added some tests