Main Script by Jannis

Main function, requires external optimizer