move everything into success function