refactor and new structure