Import code from tedit-app