very very very dirty code! but it works for me :)