Cleaned up the generated JS code a bit. Almost all tests pass in display_spec.js