added second [] to the conditional statements