small code refactor add else block