Cobbling together a js app framework for the main page