Rewrote StageWriter Function
Impletment Stage writer function.  clean up code and add cmments
Adjust Javascript file