All the block is wrongly indented: the ```else``` should be at the same level as the ```if```.