Implemented update function to work with a hashmap with the same keys as state and display