Refactored checking to make it more streamlined