Refactored the anchor generation