rewrite it to a class