Made this much simpler. Thanks to Totom3.