Refactor indicator calculation