Documentation update, bugfixes and test file