more pseudocode and loops to determine buses from data