Simplify codes and address comments.