general refactor