Database design & code update