Smooth keys in Javascript