Complete rewrite

I translate all my code in SCALA!!!!