got rid a nested if statement