Add doc strings and remove some unused code