total re-factoring to implement new ideas

and make the extension much simpler and structured.