Add Core class.
Move running flag to Core class.