Misc. refactorization