Make the populateAll function more modular