Adjusted and if statement