appjs and bbext refactoring