several improvements and corrections