bugfixes, improvments and tested first version