Fix bad coding practices