add spec tests, move elements counting to repository