Moved DB code into DB Access Layer