use function instead of declaring variable