somewhat functioning rewrite rules
added debugging and functional rewrites
holy crap rewrites work!!!