replace recursive king saftey functions with iterative approach
replace recursive king saftey functions with iterative approach