Incorporate Eugene's changes to use arrays instead of lists