scheduled task fixing and refactoring

general class refactor
fixed add_observer when state is unscheduled
fixed cancel when state is unscheduled