fix#64

  Refactored code to cleanup code - removed extra function.
  Also cleaned up the doc strings.