another attempt for variance calculation