Boilerplate code to use variables safely