Added Database functionality and fixed on start up loading