Joseph served the royal butler and baker well while they were imprisoned with him. When they each had dreams, Joseph interpreted them correctly: the butler would be restored to his position in three days, while the baker would be hanged. After three days, both dreams were fulfilled. Though the butler was freed, he forgot about Joseph for two years until Pharaoh also had dreams that needed interpreting. Joseph's accurate interpretations of the dreams led to him being appointed as vizier over all Egypt. God had orchestrated these events to preserve Joseph's family during the coming famine.