refacored functions in TabViews which use DB