adding prune method, changing append