modified if statements, more pythonic