Fix various deprecated calls and apply codestyle