move status check to func