Test fixes, refactors, etc.