added serialNumGen, its supporting function and variable