well, I did this based on what lonnen is doing in his patch (since I am editing his code)