improved some codes and output