removing redundant if condition