added rewrite rules

added a first set of rewrite rules and made some minor re-formattings