horrible C code for demonstration purposes!