Clean up the code : remove printf causing segv and define not at the right placeon.