Added DB class and some more logic to the get_reg_fields file