Update main+functions