moved functions to DocEditActivity