Fix code according to blizzz' notes