Login function amended, stored procedure amended