refactors some things