refactored for int dictionary