Changed if-statement and code layout (ty Mr. Jippi