Updated for requirejs. incomplete