If statements working properly