initial version with tests