remove unused code, fix a bug, documentation