improve calculation and filtering