Work commit

This commit have a lot of undone blocks and bugs. 
It needs for code exchange with Jay.