reorgianise if statement