Better rendering and javascript initialization (@andybak / #2)