Misc. refactors