in reply to how can this be improved?

if anyone is interested, the final code (well, final as of today) can be found at http://whippet.stanford.edu/~ssklar/aix/cinnamon/

thanks to everyone for the great advice and comments!