Updates based on porting code from sample app