More tests and refcountable functions