idle_core.c working (not thourougly tested); fixed 3 memory leaks; formatted with astyle.