Start of psuedocode to get ideas out there.