Nicer way of JS if statement.