frontend rewrite mostly