Changed to use the same key to repeat n and f