add comment for each function and fix the delete tab problem