Add context management functions