added packetlib index optmization and lockp variable renaming