Fixed if code to handle no else clause