HW3 Part1 (fix encoding)