some minor refactor