added database support | changed Auth logic