Thanks again to siran for his code!