fixed while loop problem and added log out to home page after log in