Implemented ID generation according to the current format, added debug lines to check everything works correct