I believe you can avoid the Math.Min / Max calls on these last 2 lines.  The second argument to the function should suffice in both cases if I understand the intent correctly.