Refactor code to prepare for parallel tests am: 2aaa3f84b3

Change-Id: I9f4f6d3d079bf1c59d3b2401cdda8bd2258f4a6b