I was gonna do some late night coding but then I looked at this: