Updated most of the database code. Started working on background jobs