initial implementation and tests