removing redundant IF statements