More type checking. Need to fix types everywhere.