Rewrite and organize firmware