updated how context gets passed and added comments