Made nest if statement test more comprehensive