Initial implementation and tests