some spiral refact
requirejs optional handling