added keyschedule function but not tested yet