Tidying code

- tidying up mac stuff.
- extesion name injection antihck.
- trying to kill old speed hacks (for's instead of foreach's)