Rewrite snippet into Classes