Various small code changes