optimization to the logic by merging if conditions
Merge pull request #6 from udaraliyanage/master

optimization to the logic by merging if conditions