added serial number generation