move function out of ks.ready