added comments to append function