replace context obj with simple function