Refactored to move discount logic out of search