int -> size_t to prevent potential int overflow
add cleanup function
update test
rename len to size and use a prime