cleanup utility for JavaScript