First version of the code

Well it's in fact the 3rd revision of the code.. but the other 2 were
not as good looking as this one.