Preserving resources by storing variable