Refactor for stability