Added implementations of J in sim.h and sim.c. 

Also fixed up weird tabb...