finish schedule code, althought not get correct results.