isRunning check added and other minor edits