more modular js.  still working on final version