Finished routine for subshell populations, requires testing