adding database code to redesign