Removed redundant else statement and redundat condition in factory
method.

Change-Id: Ia6882123128c1752151f4c4560cb8d1fcb57efa5