Initial version with tests