Move functions to common-functions for reuse.

Change-Id: I12a5687d94df678d7f7e8c0b075ee4aba1082156
Merge "Move functions to common-functions for reuse."