added tests, put things in a CM file
refactor to use a `list ref` instead of `int ref` and array

thanks @zii-prime