fixed some bugs, added trash/untrash, added basic func for orphans table