porting framework code from v3
Merge pull request #442 from htlxyz/master

porting framework code from v3