added  buffer overflow protection
aadded some seperation comments
added an ending at insertion method
resolved format tag issue