minor refactorings to make backpack-connect controller easier to read.