convert synthesis script to iterative version. TODO - populate it