initial implementation with some tests