code cleanup, sample app update