refactor completely