Fixed according to some of Mack's suggestions