Refactors some minor things