replaced some if/else statements with ternary operators.