formatting and commenting fixed