heavy patching

I have reworked 25% of your code base. I think you will find the changes highly optimizing and most helpful.

Regards.