various refactors