Add several improvements and fixes