First piece implementation and tests