Move pre-compute of k to end of constructor