Added closure to properly handle client generation & deletion. #refs 31