Also please move this whole check into a new function as discussed elsewhere to break the spaghetti code