Add -W flag and make required fixes