initial implementation, some minor tests