Clean up filename generation.