Integrate DB into code

As above