Adding proper credits for Pavel Sedlák
refactoring: prefer ternary operator over invoking a single method via almost identical lines