Brought else statement out one scope to fix bug