Set k to be smart enough to take a range