Added commentary; also fixed output for empty list.