Toggle ref code and add comments