rewrite of sample app