Chaning code to allow speicfying multiple locations for input and outputs