Handled else and nested if/while statements