Finished fixing authentication - works on DB also