Some documentation
removed some unused code