Refactored to avoid dead core