fixing warnings, adding docs, tests and format