Revised code in add for readability.