excellent piece of code. thank you for sharing!