Modify for porting
now it can be used in multi place