use function instead of eval