move part to porting layer
indent
update sample as