Fixing up formatting and added in ability to chain jQuery functions.

I noticed a $(this).each was being used, so I added in a return this.each instead so chainability with other functions is kept intact. I also cleaned some some of the variables and  added in missing semicolons and fixed if statements that were short-handed. Some personal preferences with formatting and whatnot might come into play here.

I indented everything 4 spaces which cleans things up too.