don't rely on error global after eval
remove unneeded initializations
don't reuse variable names in scope
dead code
remove unused variables
use regex with split
trailing comma instead of semicolon
fix punctuation and formatting
use any instead of grep when all we're looking for is the first one
remove unused function