Rewrite all

To fit jquery. Still work to do