Moved code out of context block where not required for #3612