restructured specialization, finalization and cleanup