fixing syntax errors and total breakage

title says it all.  merging straightaway; what i've done can't possibly be worse than what's up there.