refactored serial generation