helper code. todo: 'keys' function.