refactor and little changes.