also works without globals!!