integrating pre-used refs in main loop etc.