Refactoring on infra scripts

Change-Id: I764bc3b6ef1cbb782ec1e7b18c02f61f28dd7792