Further DB refinements to abstract out SQL code