fixed delete and orphaned, move package maintenance to separate file