helper function for compressing html