refactoring code a little more

Change-Id: I47f6c1073f2b0cf8532c1b3be3510c8c7d6d5590