puzzle piece directive refactored with garbage cleanup