refactored context to abstract class