Made an if more compact and simple to understand.