lots of editing to sort things out with require.js