@Olekss, here's the safest version I could come up on the spot.
@ everyone, I'd like to hear some criticism/suggestions. It seems a bit ugly, can we make it prettier without sacrificing safety? On the other hand is it completely safe?
The snippet is below: