type qualification here is ugly, but I'm not sure what else to do