all init prototypes, main loop