Extreme refactorization and requireJs dependency introduction