Somewhat quick'n'dirty, but, hey, it works.