some refactor done