Refactor code to pass metric
Merge branch 'shahdk'