added check_ref method and some tests and documentation for it