internal refactor, work in progress