improved processing script