copied code from original app