Finished the part for package end detection. Leave a problem regarding parsing length