Refactor code
Refactor if-else conditions