Completed first iteration of DB code.