Refactored WFCR code