code review with Chris: use names instead of ints for error codes. fixed mid as 2nd argument