Serious code clean-up; more meaningful test; doc's corrected