Implemented context management