Started check_k() function