Stable backup copy of js from 2014-06-02, lacks stretching, messy code with global variables