Added implementations of J in sim.h and sim.c.  Also fixed up weird tabbing format that was some of the code
Merge pull request #18 from tassiahmed/working

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