Some ease of reading modifications (ternary operators) and removed some unnecessary string manipulation.