Fix/ido2db init script

I refactored the init script a second time to get a better structure and a separation of concerns inside the script.