updated processing script for readability