minor cleanup and optimization in repo API

Change-Id: I966e67486402b1a93bcde9d22600e6007ea4cf9b
Merge "minor cleanup and optimization in repo API"