some refactor and lint