Added a Context variable and fixed some anomalies