Fixed some debug stuff, added mainslave.c