Refactored to use CoffeeScript.
Fixed some formatting behavior.