Yeah, hopefully here soon I'll get enough free time to work on putting this or similar into SQL as well.

Really a much better way to go.