Update code to work with context