Replaced IF with continue and cleaned up other IFs