Closure'd the min for better implementation