Refactor codes and cater with database changes.