rewrite some front end code