removed 4 level if statement