collect_constants function