Various cleanups

In particular corrected the usage of list vs array.