Correct with comments and add packet arithmetics functions