moved type detection to routes because that makes more sense obviously