factor out list removal into ListRemove
make ListInsert() a templated function