porting previous code to this framework