Changed lines 101, 147, 260 and 285

See commments section for a detailed discription of all changes