added login; updated sql