updating with tests for context and fixed issue where variable wasnt being set correctly