Review fixes, refactors r=rhelmer