converting from sample app to custom