Wrote initial db code