changed position of k declaration