Made better use of if statements.