completed many changes to code to optimize, zfill and automatic deletion