Refactor putEntry