I've added my modifications as comments. :)