misc. refactoring