finish another refactor attempt