replacing straight db access in views with access to controller