Refactor main to remove unnecessary else statement