First perfectly working (almost done) version.