general js syntax and whitespace cleanup