Functionality for any number of processes. Added more labels for easier readability.