Restructuring the code for SDK2.0.