refactor conway if/else