changed login to use model for database stuff