LPS-44579 Define variable closer to the use