frontend class toggle rewrite