Size optimizations and other fixes

Testing functions are only built when TESTER is defined, which significantly reduces the final binary size.
Also fixed a typo and wrapped C code with an extern.