refactor to allow for any number of processes/resources