full implementation and initial testing