Replaced a deprecated List.setElement function