Add implemenation and tests