refactored context