First implementation and tests