Completely ported the code from SDK1.0 to SDK2.0!

But this is just the beginning...