better structure refactor