complete code reorganization, now using requirejs