Finished all the database implementation

Everything now works with the database