switch implemented instead normal if else block