added first if statement to check login