refactored stopped flag to running