antialiasing function that works