Updated code to use scoped ST variable