Tweaked the 'if' statements