switch to ternary opeartor and reduce a few lines of code.