rewriten
tests and fixes
corrected settings