structure changed + some refactor