refactored code to make list keys cascade