initial refactoring to support AMD loading