added psuedocode for main processing, with notes