Changed simple if elses to ternary operations