built a ref handler