Updated to operate with requireJS