Bad code improvements