core: Add struct to handle context management