scrutinizer issues fix

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
Code refactoring

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>