Various improvements/fixes