Many fixes, improvements and additions