organize code flow and add population type arg..