version 2.1 code with some alterations made for version 2.2

first phase, still a lot work ahead of us.