Original version of shane's patch