Wow this is way more elegant and maintainable! Thank you for sharing!
No problem! Can't promise it's the most efficient, but I thought it may be useful.