refactored generate_iso and wrote some tests for it