Replaced spaces for TABs. Use of if-else instead of multiple if.