for readability I changed this to only get the value once