still working on refactoring things into AMD modules -- code is STILL UNSTABLE