Fixing Spark initialization warining, and added facility to add setup and teardown code