Multiple improvments and fixes