refactor many things