Refactored basic checks into one loop