first phase in porting old version to foundation