refactor code: remove if/else condition and replace with || operator