Various fixes, improvements