Restructure the index and add the login function