implemented scope apply