added test for references; moved tests around