refactor partially complete