refactor and updated