add comment for each function and fix delete tab problem