some  code refactor