fixed up circular import problem and cleaned up context references