made global variables static, added comments for cross-section persistence issue