fixed URL regex and some misc cleanup/reorg