add index for users and change method

* Added an index on the column for logins
* Changed the method used to query for users