Split function with boolean flag into two

Change-Id: Iece3099946329cd3f078c1adeb2a14ba41924abc