finished an incomplete refactor