Just to be clear, I decided to use generator by alex23, as it seems simple, short and understandable. Still reading this thread was quite interesting, thanks :-) -- Filip Gruszczyński