Added code to add rewrite to affect permalinks.