Add implementation and tests