creeping towards something that works
working a bit better...
rewrite rules