refactor criteria and repositories using them