works for all types