pic manager continued
added pseudo code