Slightly cleaner logic in createContext