Fixed some unused code, coding standard and add docs.