starting to modify processing function... getting hairy