cleanup repo handling code a bit