moving functionality into repositories