Refactor Maria start script

*Flatten logic for readability

[#75134504]