Restructure checkInv

For less repetition