remove some unnecessary arrays
use isEmpty