better perf for $ function