Fixed according to Mack's suggestions